<template>
<!-- 首页 广告banner -->
  <div class="ad-box">
    <!-- 根据nav bar  id 请求数据 每一个navbar 都会有这个组件 -->
    <van-swipe :autoplay="5000" indicator-color="#E5E5E5" >
      <van-swipe-item v-for="(item, index) in adImages" :key="index" @click="onChange(item,index)">
        <img v-lazy="item.coverImgUrl" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>
<script>
import LiveStatus from '../components/liveStatus';//直播状态组件
export default {
   components:{
        LiveStatus
      },
    props: {
      adImages: {
        type: Array,
        default: [],
      },
      
    },
    data() {
      return {
      };
    },
    computed: {},
    created() {},
    mounted() {},
    methods: { 
		onChange(item,index) {
      if(item.type == '1'){ //广告 长图
         this.$store.dispatch("dispatchBannerImgLink", item.typeUrl)
				 this.$router.push(`/${this.$channel}/bannerLink`);
      }else{//外链 type 0
        let getType = fun.GetUrlParam('type',item.typeUrl)
        fun.componentCreated({channle:'zhxyk',isFirstPage:getType=='special'?'1':'0'});//isFirstPage  1-跳转首页，0-返回上页，-1:隐藏公用标题，使用三方页面标题，closePage：关闭当前页面
        window.location.href = item.typeUrl
      }
          
      }, 
    },
    watch: {},
  };

</script>

<style scoped="scoped">
  .ad-box {
    padding: 0 32px;
	margin-top: 30px;
	margin-bottom: 60px;
    height: 220px;
  }
 .van-swipe{
	 height: 100%;
 }
 .van-swipe-item img{
	 width: 100%;
	 height: 100%;
	 border-radius: 16px;
 }
 /* 分页器样式 */
 .ad-box /deep/ .van-swipe__indicator{
     width: 12px;
     height: 12px;
     margin-right: 8px;
     border-radius: 50%;
     background:rgba(183, 183, 183, 0.5);
  } 
</style>
